package ru.kreda.webapp.client.view;

import ru.kreda.webapp.client.logic.SampleForm1Activity.ISampleForm1Display;

import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.HasClickHandlers;
import com.google.gwt.uibinder.client.UiBinder;
import com.google.gwt.uibinder.client.UiField;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.TextBox;
import com.google.gwt.user.client.ui.Widget;

public class SampleForm1 extends BaseContentPanel implements ISampleForm1Display {

	private static SampleForm1UiBinder uiBinder = GWT.create(SampleForm1UiBinder.class);

	interface SampleForm1UiBinder extends UiBinder<Widget, SampleForm1> {
	}

	@UiField
	TextBox inputText;
	@UiField
	Button testButton;
	@UiField
	Label outputLabel;

	public SampleForm1() {
		setWidget(uiBinder.createAndBindUi(this));
		GWT.log("SampleForm1 created");
	}

	@Override
	public String getInput() {
		return inputText.getText();
	}

	@Override
	public HasClickHandlers getTestLink() {
		return testButton;
	}

	@Override
	public void setOutput(String text) {
		outputLabel.setText(text);
	}

}
